﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


//////////////////////////////////////////////////////////////////////////
//Advisor_Default.aspx.cs                                               //
//Last Edited: 21 Mar 2012                                              //
//                                                                      //
//This file contains functionality for advisors to navigate through the //
//application                                                           //
//////////////////////////////////////////////////////////////////////////
public partial class Advisor_Default : System.Web.UI.Page
{
    /// <summary>
    /// Page_Load()
    /// 
    /// Inintializes the basic home menu for advisors
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        //Create an event when the master page is loaded so we can check whether the user is an administrator to disable certain buttons
        Page currentPage = HttpContext.Current.Handler as Page;
        currentPage.Master.Load += new EventHandler(disableButton);
        
    } // end Page_Load()
    /// <summary>
    /// disableButton
    /// 
    /// Disables/Enables the view templates button
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void disableButton(object sender, EventArgs e)
    {
        //Remove advisee no longer shows up or is enabled for anyone
        AdminPanel1.Visible = false;
        RemoveAdvisee.Enabled = false;
        if (!(Boolean)Session["isAdmin"])
        {
            //ManageCourses.Text = "Manage Courses";
            AdminPanel1.Visible = false;
            AdminPanel2.Visible = false;
            RemoveTemplate.Enabled = false;
            RemoveAdvisee.Enabled = false;
            AdminPanel3.Visible = false;
            AdminPanel4.Visible = false;
            AdminPanel5.Visible = false;
            CreateTemplate.Enabled = false;
            EditTemplate.Enabled = false;
            ManageAdmin.Enabled = false;
        }

    } // end ViewAdviseeButton_Click()

    /// <summary>
    /// ViewAdviseeButton_Click()
    /// 
    /// Redirects the user to the advisor's advisee page
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void ViewAdviseeButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Advisor/Advisee.aspx");
    } // end ViewAdviseeButton_Click()

    /// <summary>
    /// RemoveAdviseeButton_Click()
    /// 
    /// Redirects the user to the remove advisee page
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void RemoveAdviseeButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Advisor/RemoveAdvisee.aspx");
    } // end RemoveAdviseeButton_Click()

    /// <summary>
    /// CreateTemplateButton_Click()
    /// 
    /// Redirects the user to the page to create templates
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void CreateTemplateButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Advisor/Template.aspx?view=createTemplate");
    } // end CreateTemplateButton_Click()

    /// <summary>
    /// EditTemplateButton_Click()
    /// 
    /// Redirects the user to the page to edit an existing template
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void EditTemplateButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Advisor/Template.aspx?view=editTemplate");
    } // end EditTemplateButton_Click()

    /// <summary>
    /// RemoveTemplateButton_Click()
    /// 
    /// Redirects the user to the page to remove an existing template
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void RemoveTemplateButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Advisor/RemoveTemplate.aspx");
    } // end RemoveTemplateButton_Click()

    /// <summary>
    /// ManageAdmin_Click()
    /// 
    /// Redirects the user to the page to remove an existing admin
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void ManageAdmin_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Advisor/ManageAdmin.aspx");
    } // end ManageAdmin_Click()

    /// <summary>
    /// ManageCoursesButton_Click()
    /// 
    /// Redirects the user to the page to manage existing courses
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void ManageCoursesButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Advisor/ManageCourse.aspx");
    } // end ManageCoursesButton_Click()

    /// <summary>
    /// HelpButton_Click()
    /// 
    /// Redirects the user to the help page for advisor's
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void HelpButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Advisor/Help.aspx");
    } // end HelpButton_Click()

    /// <summary>
    /// CreateCourses_Click()
    /// 
    /// Redirects the user to page to create courses
    /// </summary>
    /// <param name="sender">object sender (unused, required by ASP.NET) - web control that called the function</param>
    /// <param name="e">EventArgs e (unused, required by ASP.NET) - other arguments for the function</param>
    protected void CreateCourses_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Advisor/CreateCourses.aspx");
    } // end CreateCourses_Click()
}